package com.aruba.mapper;

import com.aruba.bean.Dept;
import org.apache.ibatis.annotations.*;
import org.mybatis.caches.ehcache.EhcacheCache;

import java.util.List;

//@CacheNamespace(implementation = EhcacheCache.class)
public interface DeptMapper {
    /**
     * 根据部门编号查询部门
     *
     * @param deptno
     * @return
     */
//    @Select("select * from dept where deptno = #{no}")
    Dept findDeptByDeptno(@Param("no") int deptno);

    /**
     * 新增一个部门信息
     *
     * @param dept
     * @return
     */
    @Insert("insert into dept values(#{deptno},#{dname},#{loc})")
    int addDept(Dept dept);

    /**
     * 根据部门编号更新部门信息
     *
     * @param dept
     * @return
     */
    @Update("update dept set dname = #{dname}, loc = #{loc} where deptno = #{deptno}")
    int updateDept(Dept dept);

    /**
     * 根据部门编号删除部门
     *
     * @param deptno
     * @return
     */
    @Delete("delete from dept where deptno = #{deptno}")
    int deleteDeptbyDeptno(int deptno);
}
